package fip.gateway.dep.sender.impl;

import fip.gateway.dep.sender.IMessageSender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.jms.Destination;
import java.io.Serializable;

/**
 * @author zhangxiaobo
 *
 */
@Service
public class DepMessageSender implements IMessageSender,Serializable {
	
	private static final Logger logger = LoggerFactory.getLogger(DepMessageSender.class);
	@Resource(name="jmsSendTemplate")
    private JmsTemplate jmsTemplate;
//	@Resource(name="s_haierfip_realtime_unionpay_realtime_queque")
	@Resource(name="send.unipay")
    private Destination destination;
    
    /* (non-Javadoc)
	 * @see com.fbi.jms.impl.IMessageSender#sendMsg(org.springframework.jms.core.MessageCreator)
	 */
    @Override
	public  void sendMsg(MessageCreator msgCreator) {
    	jmsTemplate.send(destination, msgCreator);
    }

	public Destination getDestination() {
		return destination;
	}

	public void setDestination(Destination destination) {
		this.destination = destination;
	}

	public JmsTemplate getJmsTemplate() {
		return jmsTemplate;
	}

	public void setJmsTemplate(JmsTemplate jmsTemplate) {
		this.jmsTemplate = jmsTemplate;
	}
}
